#include <iostream>
#include <fstream>
#include <string>

using namespace std;

template <class T>
class MinStackElement
{
public:
	T data; // the data stored
	T min; // the minimum element under the current element
};

template <class T>
class MinStack
{
public:
	MinStack(int max_size);
	void push(T new_data);
	T pop();
	T minElement();

private:
	MinStackElement<T> *elements;
	int size;
	int top;
};

template <class T>
MinStack<T>::MinStack(int max_size)
{
	elements = new MinStackElement<T>[max_size];
	size = max_size;
	top = 0;
}

template <class T>
void MinStack<T>::push(T new_data)
{
	top ++;
	elements[top - 1].data = new_data;

	if(top == 1)
	{
		elements[top - 1].min = new_data;
	}
	else
	{
		if(new_data < elements[top - 2].min)
		{
			elements[top - 1].min = new_data;
		}
		else
		{
			elements[top - 1].min = elements[top - 2].min;
		}
	}
}

template <class T>
T MinStack<T>::pop()
{
	if(top == 0)
		return T();

	T value;
	
	value = elements[top - 1].data;
	top --;
	return value;
}

template <class T>
T MinStack<T>::minElement()
{
	return elements[top - 1].min;
}

int main() {
	ifstream fin ("minstack.in");
	ofstream fout ("minstack.out");
	int instruction, num;
	MinStack<int> min_stack(50);
	
	if(fin.good() == false)
	{
		fout << "file open failed" << endl;
		return 0;
	}
	
	while(true)
	{
		if(fin.eof())
			break;
		
		fin >> instruction;
			
		if(instruction == 1)
		{
			fin >> num;
			min_stack.push(num);
			fout << "push : " << num << ", the minimum element : " << min_stack.minElement() << endl;
		}
		else if(instruction == 2)
		{
			num = min_stack.pop();
			fout << "pop : " << num << ", the minimum element : " << min_stack.minElement() << endl;
		}
	}
}